<template>
    <div>
        <div class="trend"></div>
        <div class="tab">
            <div @click="tabNumChange(0)"
                :style="{ color: tabNum === 0 ? '#f2ce3d' : '#a8aea8', backgroundColor: tabNum === 0 ? '#2e323b' : '#17171a' }"
                class="item">{{ $t('做多') }}</div>
            <div @click="tabNumChange(1)"
                :style="{ color: tabNum === 1 ? '#f2ce3d' : '#a8aea8', backgroundColor: tabNum === 1 ? '#2e323b' : '#17171a' }"
                class="item">{{ $t('做空') }}</div>
            <div @click="tabNumChange(2)"
                :style="{ color: tabNum === 2 ? '#f2ce3d' : '#a8aea8', backgroundColor: tabNum === 2 ? '#2e323b' : '#17171a' }"
                class="item">{{ $t('交易') }}</div>
        </div>
        <div class="conversion">
            <div class="title">
                <span @click="conversionNumC(0)"
                    :style="{ color: conversionNum === 0 ? '#fff' : '#a8aea8' }">{{ $t('市場') }}</span>
                <span @click="conversionNumC(1)"
                    :style="{ color: conversionNum === 1 ? '#fff' : '#a8aea8' }">{{ $t('限制') }}</span>
            </div>
            <div class="item">
                <div class="top">
                    <div class="left">{{ $t('支付') }}</div>
                    <div class="right">
                        <span style="color: #a8a8a8;">{{ $t('餘額') }}：</span>
                        <span style="color: #fff;">0</span>
                        <span style="color: #f2ce3d;">All</span>
                    </div>
                </div>
                <div class="btm">
                    ETH
                </div>
            </div>
            <div style="width: 100%;height: 6px;"></div>
            <div class="item">
                <div class="top">
                    <div class="left">{{ $t('做多') }}</div>
                    <div class="right">
                        <span style="color: #a8a8a8;">{{ $t('餘額') }}：</span>
                        <span style="color: #fff;">0</span>
                        <span style="color: #f2ce3d;">All</span>
                    </div>
                </div>
                <div class="btm">
                    ETH
                </div>
            </div>
            <img src="@/assets/contract/duihuan.png" class="duihuan" alt="">
        </div>
        <div class="Leverage">
            <div class="title">
                <div class="left">Leverage slider</div>
                <div class="right">
                    <van-switch active-color="#f2ce3d" inactive-color="#2e323b" size="15px" />
                </div>
            </div>
            <van-slider style="margin-top: 16px;" v-model="slider" bar-height="4px" active-color="#f2ce3d" :step="10">
                <template #button>
                    <div class="custom-button">{{ slider }}</div>
                </template>
            </van-slider>
            <div class="item">
                <div class="le">{{ $t('可用') }}</div>
                <div class="ri">-BTC</div>
            </div>
            <div class="item">
                <div class="le">{{ $t('保證金') }}</div>
                <div class="ri">-ETH</div>
            </div>
            <div class="btn">
                <van-button color="#f2ce3d">{{ $t('確認') }}</van-button>
            </div>
        </div>
        <div class="bottom">
            <div class="title">
                <span @click="bottomNumC(0)" :style="{ color: bottomNum === 0 ? '#fff' : '#a8aea8' }">{{ $t('持倉列表') }}</span>
                <span @click="bottomNumC(1)" :style="{ color: bottomNum === 1 ? '#fff' : '#a8aea8' }">{{ $t('當前委託') }}</span>
                <span @click="bottomNumC(2)" :style="{ color: bottomNum === 2 ? '#fff' : '#a8aea8' }">{{ $t('交易') }}</span>
            </div>
            <div class="content">
                <div class="kong">
                    <img src="@/assets/exchange/qianbao.png" alt="">
                    <div class="lianjie">
                        <span style="color: #f2ce3d;">{{ $t('連接') }}</span>
                        <span> {{ $t('去交易') }}</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
import { ref } from 'vue'

//做多 做空 交易
const tabNum = ref(0)
//市场 限制
const conversionNum = ref(0)
//持倉列表 當前委託 交易
const bottomNum = ref(0)
//滑块
const slider = ref(30)

function tabNumChange(num) {
    if (num === tabNum.value) return
    tabNum.value = num
}

function conversionNumC(num) {
    if (num === conversionNum.value) return
    conversionNum.value = num
}

function bottomNumC(num) {
    if (num === bottomNum.value) return
    bottomNum.value = num
}
</script>

<style lang="scss" scoped>
.trend {
    width: 100%;
    height: 380px;
    background-color: #fff;
}

.tab {
    display: flex;
    align-items: center;
    width: 100%;
    height: 43px;
    border: 0.5px solid #324040;
    border-radius: 8px;
    margin: 12px 0;
    padding: 1px;

    .item {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 33.33%;
        height: 100%;
        border-radius: 8px;
        font-size: 15px;
    }
}

.conversion {
    position: relative;
    width: 100%;

    .title {
        width: 100%;
        font-size: 14px;
        margin-bottom: 14px;

        span {
            padding: 0 10px;
        }
    }

    .item {
        width: 100%;
        height: 89px;
        background-color: #2e323b;
        border-radius: 10px;
        padding: 15px;
        box-sizing: border-box;

        .top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;

            .left {
                font-size: 14px;
                color: #a8a8a8;
            }

            .right {
                font-size: 14px;
                color: #fff;

                span {
                    margin-left: 5px;
                }
            }
        }

        .btm {
            display: flex;
            justify-content: end;
            font-size: 17px;
            color: #fff;
        }
    }

    .duihuan {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -13%);
        width: 42px;
        height: 42px;
    }
}

.Leverage {
    width: 100%;
    margin-top: 16px;

    .title {
        display: flex;
        justify-content: space-between;
        width: 100%;
        font-size: 14px;
        color: #a8a8a8;

        .left {}

        .right {}
    }

    .custom-button {
        width: 30px;
        height: 30px;
        border-radius: 50%;
        color: #fff;
        font-size: 15px;
        line-height: 30px;
        text-align: center;
        background-color: #f2ce3d;
        border-radius: 100px;
    }

    .item {
        display: flex;
        justify-content: space-between;
        width: 100%;
        margin-top: 16px;
        font-size: 14px;
        color: #ccc;

        .le {}

        .ri {}
    }

    .van-button {
        color: #2e323b !important;
        width: 100%;
        height: 40px;
        margin-top: 16px;
        border-radius: 8px;
        background-color: #f2ce3d;
    }
}

.bottom {
    width: 100%;
    height: 100%;
    background-color: #17171a;
    padding: 15px 0;
    box-sizing: border-box;

    .title {
        width: 100%;
        height: 20px;
        color: #fff;
        font-size: 14px;

        span {
            padding: 0 10px;
        }

    }

    .content {
        width: 100%;
        height: 300px;

        .kong {
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            width: 100%;
            height: 100%;
            color: #a8aea8;
            font-size: 14px;

            img {
                width: 77px;
                height: 83px;
            }

        }
    }
}
</style>